package com.sptpc.demo.global.exception;

import com.sptpc.demo.global.response.BusinessesStatusCode;
import lombok.Getter;

public class BusinessException extends RuntimeException{

    @Getter
    private BusinessesStatusCode errorCode;

    // 只封装错误消息
    public BusinessException(String errMsg){
        super(errMsg);
        this.errorCode=BusinessesStatusCode.FAILURE;
    }

    // 封装返回码和错误消息
    public BusinessException(BusinessesStatusCode errorCode){
        super(errorCode.getMsg());
        this.errorCode=errorCode;
    }
}
